﻿CREATE TABLE [dbo].[DocumentePlata] (
    [IDDocumentPlata]  INT             IDENTITY (1, 1) NOT NULL,
    [Numar]            VARCHAR (20)    NOT NULL,
    [Data]             DATETIME        NOT NULL,
    [IDTipPlata]       SMALLINT        NOT NULL,
    [ValoareTotala]    DECIMAL (18, 2) CONSTRAINT [DF_DocumentePlata_Valoare] DEFAULT ((0)) NOT NULL,
    [IDPartener]       BIGINT          NOT NULL,
    [Reprezentand]     VARCHAR (250)   NULL,
    [TipOperatiune]    VARCHAR (10)    CONSTRAINT [DF_DocumentePlata_TipOperatiune] DEFAULT ('INC') NOT NULL,
    [CodUnitate]       SMALLINT        CONSTRAINT [DF_DocumentePlata_CodUnitate] DEFAULT ((0)) NOT NULL,
    [DataExtras]       DATETIME        NULL,
    [Serie]            VARCHAR (10)    NULL,
    [ValoareTotalaTVA] DECIMAL (18, 2) DEFAULT ((0)) NOT NULL,
    CONSTRAINT [PK_DocumentePlata] PRIMARY KEY CLUSTERED ([IDDocumentPlata] ASC),
    CONSTRAINT [FK_DocumentePlata_Parteneri] FOREIGN KEY ([IDPartener]) REFERENCES [dbo].[Parteneri] ([IDPartener]),
    CONSTRAINT [FK_DocumentePlata_TipDocumentPlata] FOREIGN KEY ([IDTipPlata]) REFERENCES [dbo].[TipDocumentPlata] ([IDTipPlata]),
    CONSTRAINT [FK_DocumentePlata_Unitati] FOREIGN KEY ([CodUnitate]) REFERENCES [dbo].[Unitati] ([CodUnitate])
);

